package sample3.visitor;

import sample3.evaluators.DivEvaluator;
import sample3.evaluators.IntEvaluator;
import sample3.evaluators.MinusEvaluator;
import sample3.evaluators.ModEvaluator;
import sample3.evaluators.NegationEvaluator;
import sample3.evaluators.PlusEvaluator;
import sample3.evaluators.TimesEvaluator;

public class PrintVisitor implements Visitor {

	String out = "";

	public String getOut() {
		return out ;
	}

	public void visit(DivEvaluator evaluator) {
		out = out + " div(";
		evaluator.op1.accept(this);
		evaluator.op2.accept(this);
		out = out + " )";

	}

	public void visit(IntEvaluator evaluator) {
		out = out + " " + evaluator.evaluate();
	}

	public void visit(MinusEvaluator evaluator) {
		out = out + " minus(";
		evaluator.op1.accept(this);
		evaluator.op2.accept(this);
		out = out + " )";

	}

	public void visit(PlusEvaluator evaluator) {
		out = out + " plus(";
		evaluator.op1.accept(this);
		evaluator.op2.accept(this);
		out = out + " )";

	}

	public void visit(TimesEvaluator evaluator) {
		out = out + " times(";
		evaluator.op1.accept(this);
		evaluator.op2.accept(this);
		out = out + " )";

	}

	public void visit(ModEvaluator evaluator) {
		out = out + " mod(";
		evaluator.op1.accept(this);
		evaluator.op2.accept(this);
		out = out + " )";
	}

	public void visit(NegationEvaluator evaluator) {
		
	}

}
